import java.util.Scanner;
import java.util.Arrays;
public class test424 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter the first city: ");
        String city1 = scanner.nextLine();
        System.out.print("Enter the second city: ");
        String city2 = scanner.nextLine();
        System.out.print("Enter the third city: ");
        String city3 = scanner.nextLine();
        String[] cities = {city1, city2, city3};
        Arrays.sort(cities);
        System.out.print("The three cities in alphabetical order are ");
        for (int i = 0; i < cities.length; i++) {
            System.out.print(cities[i] + (i < cities.length - 1 ? " " : ""));
        }
        scanner.close();
    }
}

